﻿<?php
require_once 'tree.class.php';
$tree = new Tree();
$newssorts = array(
	1 => array('cid'=>'1','parentid'=>0,'name'=>'一级栏目一'),
	2 => array('cid'=>'2','parentid'=>0,'name'=>'一级栏目二'),
	3 => array('cid'=>'3','parentid'=>1,'name'=>'二级栏目一'),
	4 => array('cid'=>'4','parentid'=>1,'name'=>'二级栏目二'),
	5 => array('cid'=>'5','parentid'=>2,'name'=>'二级栏目三'),
	6 => array('cid'=>'6','parentid'=>3,'name'=>'三级栏目一'),
	7 => array('cid'=>'7','parentid'=>3,'name'=>'三级栏目二')
	);
$tree->init($newssorts);
$newssort = $tree->getTree(-1, '<option value="{cid}"{selected}>{spacer}{name}</option>','selected="selected"');
$tree_arr = $tree->getTreeArr();
echo "<pre>";
print_r( $tree_arr ) ;
echo '<select>' . $newssort . '</select>';
?>